# -*- encoding: utf-8 -*-
"""
File Name: problems_loader
Description:
Author : 'lirui'
date: 2024/2/18
Contact: marjey_lee@163.com
Change Activity:
2024/2/18:
"""
import json

from ll.third_party.redis_util.redis_client import RedisClient
from ll.utils.bytes_util import byte_to_str


class ProblemsLoader:
    def __init__(self, ):
        self.redis_client = RedisClient()
        self.keys = [
            'branch_dedicated_line_monitor',
            'dedicated_line_problems',
            'zabbix_current_problems'
        ]

    def load(self):
        ps = {}
        for k in self.keys:
            p = self.redis_client.get(k)
            p = byte_to_str(p)
            p = json.loads(p)
            ps[k] = p
        return ps
